import * as actionTypes from './actionTypes'
import axios from 'axios'

const ActionGetHomeData = (data) => ({
    type: actionTypes.GET_HOME_DATA,
    articleList: data.articleList,
    recommendList: data.recommendList,
    topicList: data.topicList
})

const ActionGetMoreList = (data) => ({
    type: actionTypes.GET_HOME_DATA,
    
})

export const getHomeData = () => {
    return (dispatch) => {
        axios.get('/api/home.json').then((res) => {
            dispatch(ActionGetHomeData(res.data.data))
        })
    }
}

export const getMoreList = () =>{
    return (dispatch) => {
        axios.get('/api/homeList.json').then((res) => {
            dispatch(ActionGetMoreList(res.data.data)) 
        })
    }
}
